package com.bincloud.vue.admin.common.enums.ums;

import lombok.Getter;

/**
 * @Description: 资源状态枚举
 * @Author: bincloud, mvpzhou
 * @Date: Create By bincloud, mvpzhou on 2022/2/16
 */
@Getter
public enum UmsResourceStateEnum {
    /**
     * 资源状态枚举
     * 状态(0 启用 1 禁用)
     */
    ENABLE(0, "启用"),
    DISABLED(1, "禁用"),
    ;

    UmsResourceStateEnum(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private final int code;
    private final String msg;

    public static boolean noCode(int code) {
        for (UmsResourceStateEnum e : UmsResourceStateEnum.values()) {
           if (e.code == code) {
               return false;
           }
        }
        return true;
    }

    public static boolean hasCode(int code) {
        for (UmsResourceStateEnum e : UmsResourceStateEnum.values()) {
           if (e.code == code) {
               return true;
           }
        }
        return false;
    }

    public static String getContentByCode(int code) {
        for (UmsResourceStateEnum e : UmsResourceStateEnum.values()) {
           if (e.code == code) {
               return e.msg;
           }
        }
        return "";
    }
}
